package com.hui.aop;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zkn on 2016/11/19.
 */
@Api(tags = "aop测试")
@RestController
@RequestMapping("/aop")
public class AopTestController {

    @ApiOperation(value = "方法之前处理")
    @GetMapping("/testBeforeService.do")
    public String testBeforeService(@RequestParam String key, @RequestParam String value){
        return "key="+key+"  value="+value;
    }

    @ApiOperation(value = "方法之后处理")
    @GetMapping("/testAfterReturning.do")
    public String testAfterReturning(@RequestParam String key){
        return "key=: "+key;
    }


//    @GetMapping("/testAfterThrowing.do")
//    public String testAfterThrowing(@RequestParam String key){
//
//        throw new NullPointerException();
//    }
//    @GetMapping("/testAfter.do")
//    public String testAfter(@RequestParam String key){
//
//        throw new NullPointerException();
//    }

//    @GetMapping("/testAroundService.do")
//    public String testAroundService(@RequestParam String key){
//
//        return "环绕通知："+key;
//    }
}